import request from '@/utils/request'
import qs from 'qs';

// 取订单详情
export function queryOrderIdInfo(params) {
  return request({
    // baseURL: '',
    //baseURL: 'https://www.easy-mock.com/mock/5a080420691f1a0ce13f7b72/example/assetbm/payinstallment/stage/query',
    url: '/api/assetbm/payinstallment/stage/query',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    params,
    data: qs.stringify(params)
  })
}

// 点击下一步更新后台订单
export function installOrderId(params) {
  return request({
    // baseURL: '',
    //baseURL: 'https://www.easy-mock.com/mock/5a080420691f1a0ce13f7b72/example/assetbm/payinstallment/stage/query',
    url: '/api/assetbm/payinstallment/OrderInstallPay/pcinstallorder.do',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    params,
    data: qs.stringify(params)
  })
}

// 取商户费率和期数
export function getRateInfo(params, data) {
  debugger
  // data = { 'cardNo': 35687912345, 'sceneId': 1021 }
  return request({
    // baseURL: '',
    //baseURL: 'https://www.easy-mock.com/mock/5a080420691f1a0ce13f7b72/example/allinpay/order/orderinstall/queryRate',
    //url: '/api/FuLiBao/v2/mer/getMerInfo',
    url: '/api/assetbm/rest/order/orderinstall/queryrate',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': 'application/json'
    },

    method: 'post',
    data: qs.stringify(params)
  })
}

// 发送短信
export function senddx(params) {
  return request({
    // baseURL: '',
    //baseURL: 'https://www.easy-mock.com/mock/5a080420691f1a0ce13f7b72/example/assetbm/payinstallment/stage/query',
    url: '/api/assetbm/sms/send',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': 'application/json'
    },
    // params,

    data: qs.stringify(params)
  })
}

// 支付交易接口
export function installpay(params) {
  return request({
    // baseURL: '',
    //baseURL: 'https://www.easy-mock.com/mock/5a080420691f1a0ce13f7b72/example/assetbm/payinstallment/stage/query',
    url: '/api/assetbm/rest/card/installpay/pay',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': 'application/json'
    },
    // params,

    data: qs.stringify(params)
  })
}

/****************************************************/

// 订单详情
export function getOrderDetail(params, data) {
  return request({
    baseURL: '',
    // url: '/detailapi/FuLiBao/LFQCreateOrderServlet?_=1523519105886',
    url: '/api/FuLiBao/LFQCreateOrderServlet',
    method: 'post',
    params,
    data
  })
}

// 填写个人信息
// 发送短信,参数全传
export function bindCardSms(params) {
  // data = { 'cardNo': 35687912345, 'sceneId': 1021 }
  return request({
    // baseURL: '',
    // baseURL: 'https://www.easy-mock.com/mock/5acf1d2046da7b53fb4e2a27/mobile1',
    url: '/api/FuLiBao/v2/order/bindCardSms',
    method: 'post',
    params
  })
}

// 填写个人信息,确认
export function createOrderServlet(params) {
  // data = { 'cardNo': 35687912345, 'sceneId': 1021 }
  return request({
    // baseURL: '',
    // baseURL: 'https://www.easy-mock.com/mock/5acf1d2046da7b53fb4e2a27/mobile1',
    url: '/api/FuLiBao/LFQCreateOrderServlet',
    method: 'post',
    params
  })
}

// 获取金额分期信息
export function getTimesMoney(data) {
  return request({
    // baseURL: 'https://www.easy-mock.com/mock/5acf1d2046da7b53fb4e2a27/mobile1',
    url: '/api/FuLiBao/v2/order/money',
    method: 'post',
    data
  })
}

// 重新生成订单
export function getDetailLFQCreateOrderServlet(data) {
  return request({
    // baseURL: 'https://www.easy-mock.com/mock/5acf1d2046da7b53fb4e2a27/mobile1',
    url: '/api/FuLiBao/LFQCreateOrderServlet',
    method: 'post',
    // params: data,
    data
  })
}

// 查询订单情况
export function searchOrderServlet(params, data) {
  data = { 'cardNo': 35687912345, 'sceneId': 1021 }
  return request({
    baseURL: '',
    url: '/api/FuLiBao/LFQSearchOrderServlet',
    method: 'post',
    params,
    data
  })
}
